<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" errorPage="/errpage.jsp" %>
<%@ page import="java.util.*" %>
<%@ page import="com.soft.model.*" %>
<!DOCTYPE html>
<html>
<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title></title>
		<link rel="stylesheet" href="/css/index.css" />
		<link rel="stylesheet" href="/css/left-top.css" />
		<script type="application/javascript" src="/js/jquery-3.3.1.js"></script>
		<script type="application/javascript" src="/js/common.js"></script>
		<script type="application/javascript">
			$(document).ready(function() {
				$(".level1-menu").mouseout(function(event) {
					$(event.target).removeClass("bg-color-red");
				});

				$(".level1-menu").mouseover(function(event) {
					$(event.target).addClass("bg-color-red");
				});

				$(".level1-menu").click(function(event) {
// 					debugger
// 					$(event.target).next().toggleClass("disappear");
					$(event.target).next().toggle();
				});

				$(".level2-menu").children("li").click(function(event) {
					$(".level2-menu").children("li").each(function(target) {
						$(this).removeClass("bg-color-red");
					});
					
					$(this).addClass("bg-color-red");
					var url = "";
					url += $(event.target).attr("ad-link") + "";
					window.location.href="/"+url;
				});
			});
		</script>
	</head>
	<body class="left-menu-body">
		<div class="left-menu-container bg-color-black">
			<%
				List<Permission> list_up = (List<Permission>) session.getAttribute("list_up");
				if(list_up!=null && list_up.size()>0){
				for(Permission p1 : list_up){
					pageContext.setAttribute("p1", p1);
			%>
			<div class="left-menu-item col-item">
				<div class="level1-menu col-item bg-color-black font-white font-normal">${p1.permissionName }</div>
				<ul ad-link="${p1.permissionContext }" class="level2-menu moving col-item">
					<%
					List<Permission> list_p2 = p1.getList_permission();
					for(Permission p2 : list_p2){
						pageContext.setAttribute("p2", p2);
					%>
						<li ad-link="${p2.permissionContext }" class="font-small bg-color-blue font-white">${p2.permissionName }</li>
					<%} %>
				</ul>
			</div>
			<%
				}
				}
			%>
		</div>
	</body>
</html>
